package ddd7;

import java.util.HashMap;
import java.util.Map;

public class KeyToLock {
    public static void main(String[] args) {
        String input = "YUANzhi1987";
        StringBuilder sb = new StringBuilder();
        Map<Character, Character> keyboardMap = buildKeyboardMap();

        for (char c : input.toCharArray()) {
            if (Character.isUpperCase(c)) {
                sb.append((char)(Character.toLowerCase(c) == 'z' ? 'a' : Character.toLowerCase(c) + 1));
            } else if (Character.isLowerCase(c)) {
                sb.append(keyboardMap.get(c));
            } else {
                sb.append(c);
            }
        }

        System.out.println(sb);
    }

    private static Map<Character, Character> buildKeyboardMap() {
        Map<Character, Character> map = new HashMap<>();
        String[] keys = {
                "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"
        };
        for (int i = 0; i < keys.length; i++) {
            for (char c : keys[i].toCharArray()) {
                map.put(c, (char)('2' + i));
            }
        }
        return map;
    }
}
